package com.bluetron.supos.apps.services.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bluetron.supos.apps.mappers.ExampleMapper;
import com.bluetron.supos.apps.mappers.entities.ExamplePO;
import com.bluetron.supos.apps.services.ExampleService;

/**
 * 示例服务实现
 */
@Service
public class ExampleServiceImpl implements ExampleService {

    @Autowired
    private ExampleMapper exampleMapper;

    @Override
    public String sayHello(String name) {
        /**
         * 请尽量使用Mybatis-plus的条件构造器来完成SQL拼接操作
         */
        long count = this.exampleMapper.selectCount(new LambdaQueryWrapper<ExamplePO>()
            .eq(ExamplePO::getName, name)
            .orderByAsc(ExamplePO::getId));
        return "Hello, " + name + "!" + count;
    }

}
